<template>
  <div>
    <!-- 面包屑导航区域 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">
        当前位置：首页
      </el-breadcrumb-item>
      <el-breadcrumb-item>医院管理</el-breadcrumb-item>
      <el-breadcrumb-item>医院管理</el-breadcrumb-item>
    </el-breadcrumb>

    <el-form
      :model="addForm"
      :rules="addFormRules"
      ref="addFormRef"
      label-width="110px"
      label-position="left"
    >
      <!-- 基本信息表单 -->
      <el-card>
        <div slot="header">
          <span>基本信息</span>
        </div>
        <div class="baseInfoDiv">
          <el-form-item label="医院名称" prop="title">
            <el-input v-model="addForm.title" placeholder="请输入"></el-input>
          </el-form-item>
          <el-form-item label="所属服务商" prop="provider_id">
            <el-select
              v-model="addForm.provider_id"
              placeholder="请选择"
              filterable
              clearable
            >
              <el-option
                v-for="item in selectData.provider"
                :key="item.id"
                :label="item.name + '【' + item.id + '】'"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="电话" prop="tel">
            <el-input v-model="addForm.tel" placeholder="请输入"></el-input>
          </el-form-item>
          <el-form-item label="所在区域" prop="area">
            <el-cascader
              :options="options"
              :props="props"
              clearable
              filterable
              v-model="addForm.area"
              placeholder="请选择省市区"
            ></el-cascader>
          </el-form-item>
          <el-form-item label="详细地址" prop="address">
            <el-input v-model="addForm.address" placeholder="请输入"></el-input>
          </el-form-item>
          <el-form-item label="经纬度" required>
            <el-row :gutter="10">
              <el-col :span="10">
                <el-form-item prop="lat">
                  <el-input
                    v-model="addForm.lat"
                    placeholder="请输入纬度"
                    oninput="value=value.replace(/[^0-9.]/g,'')"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item prop="lng">
                  <el-input
                    placeholder="请输入经度"
                    v-model="addForm.lng"
                    oninput="value=value.replace(/[^0-9.]/g,'')"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="4" style="text-align: right">
                <el-button
                  size="small"
                  @click="findAddress"
                  class="theme-background-color"
                  >查询</el-button
                >
              </el-col>
            </el-row>
          </el-form-item>
          <el-form-item label="医院负责人" prop="leading_name">
            <el-input
              v-model="addForm.leading_name"
              placeholder="请输入负责人姓名"
            ></el-input>
          </el-form-item>
          <el-form-item label="负责人电话" prop="leading_phone">
            <el-input
              v-model="addForm.leading_phone"
              placeholder="请输入负责人联系电话"
            ></el-input>
          </el-form-item>
          <el-form-item label="员工人数" prop="employee_num">
            <el-input
              v-model="addForm.employee_num"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
          <el-form-item label="营业时间" required>
            <el-row :gutter="10">
              <el-col :span="11">
                <el-form-item prop="working_duration_start">
                  <el-time-select
                    placeholder="起始时间"
                    v-model="addForm.working_duration_start"
                    :picker-options="{
                      start: '06:00',
                      step: '00:15',
                      end: '24:00'
                    }"
                  >
                  </el-time-select>
                </el-form-item>
              </el-col>
              <el-col style="text-align: center" :span="2">至</el-col>
              <el-col :span="11">
                <el-form-item prop="working_duration_end">
                  <el-time-select
                    placeholder="结束时间"
                    v-model="addForm.working_duration_end"
                    :picker-options="{
                      start: '06:00',
                      step: '00:15',
                      end: '24:00',
                      minTime: addForm.working_duration_start
                    }"
                  >
                  </el-time-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form-item>
          <el-form-item label="营业项目" prop="service_item">
            <el-checkbox-group v-model="addForm.service_item">
              <el-checkbox
                v-for="item in selectData.get_hospital_service"
                :key="item.id"
                :label="item.id + ''"
                >{{ item.name }}</el-checkbox
              >
            </el-checkbox-group>
          </el-form-item>
          <el-form-item label="医院端系统" prop="use_system">
            <el-select
              v-model="addForm.use_system"
              placeholder="请选择"
              filterable
              clearable
            >
              <el-option
                key="1"
                label="使用"
                :value="typeof addForm.use_system == 'string' ? '1' : 1"
              ></el-option>
              <el-option
                key="0"
                label="不使用"
                :value="typeof addForm.use_system == 'string' ? '0' : 0"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="结算类型" prop="clear_type">
            <el-select
              v-model="addForm.clear_type"
              placeholder="请选择"
              filterable
              clearable
            >
              <el-option
                key="1"
                label="现结"
                :value="typeof addForm.clear_type == 'string' ? '1' : 1"
              ></el-option>
              <el-option
                key="2"
                label="月结"
                :value="typeof addForm.clear_type == 'string' ? '2' : 2"
              ></el-option>
              <el-option
                key="3"
                label="自助提现"
                :value="typeof addForm.clear_type == 'string' ? '3' : 3"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="备注" prop="remark">
            <el-input
              type="textarea"
              v-model="addForm.remark"
              placeholder="请输入"
              show-word-limit
              maxlength="500"
            >
            </el-input>
          </el-form-item>
        </div>
      </el-card>

      <el-card class="imageCard">
        <div slot="header">
          <span>证件及医院形象照</span>
        </div>
        <el-row>
          <el-col :span="8">
            <el-form-item label="营业执照" prop="business_licence">
              <el-upload
                :action="ossUrl"
                :headers="ossHeader"
                list-type="picture-card"
                :auto-upload="true"
                :limit="1"
                v-model="addForm.business_licence"
                :on-success="uploadSuccessMain"
                :on-preview="handlePictureCardPreview"
                :on-remove="handleRemoveMain"
                :on-error="uploadError"
                :data="{ system: 'hospital', module: '营业执照' }"
                :class="{ uoloadSty: showBtn1, disUoloadSty: noneBtn1 }"
                :on-change="imgChangeMain"
                :before-upload="beforeUpload"
                :file-list="addForm.business_licence_List"
              >
                <i slot="default" class="el-icon-plus"></i>
                <div
                  style="
                    transform: translateY(-85%);
                    color: grey;
                    font-size: 14px;
                  "
                >
                  上传图片
                </div>
                <div class="el-upload__tip" slot="tip">
                  <ul
                    style="margin-left: -25px; line-height: 20px; color: grey"
                  >
                    <li>请上传jpg或png格式的图片，大小不超过2M</li>
                    <li>保持营业执照信息齐全，清晰无遮挡</li>
                  </ul>
                </div>
              </el-upload>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="动物诊疗许可证" prop="animal_licence">
              <el-upload
                :action="ossUrl"
                :headers="ossHeader"
                list-type="picture-card"
                :auto-upload="true"
                :limit="1"
                v-model="addForm.animal_licence"
                :on-success="uploadSuccess2"
                :on-preview="handlePictureCardPreview"
                :on-remove="handleRemove2"
                :on-error="uploadError"
                :data="{ system: 'chongtai', module: '动物诊疗许可证' }"
                :class="{ uoloadSty: showBtn2, disUoloadSty: noneBtn2 }"
                :on-change="imgChangeMain2"
                :before-upload="beforeUpload"
                :file-list="addForm.animal_licence_List"
              >
                <i slot="default" class="el-icon-plus"></i>
                <div
                  style="
                    transform: translateY(-85%);
                    color: grey;
                    font-size: 14px;
                  "
                >
                  上传图片
                </div>
                <div class="el-upload__tip" slot="tip">
                  <ul
                    style="margin-left: -25px; line-height: 20px; color: grey"
                  >
                    <li>请上传jpg或png格式的图片，大小不超过2M</li>
                    <li>保持证照清晰无遮挡</li>
                  </ul>
                </div>
              </el-upload>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="公共卫生许可证" prop="public_licence">
              <el-upload
                :action="ossUrl"
                :headers="ossHeader"
                list-type="picture-card"
                :auto-upload="true"
                :limit="1"
                v-model="addForm.public_licence"
                :on-success="uploadSuccess3"
                :on-preview="handlePictureCardPreview"
                :on-remove="handleRemove3"
                :on-error="uploadError"
                :data="{ system: 'chongtai', module: '公共卫生许可证' }"
                :class="{ uoloadSty: showBtn3, disUoloadSty: noneBtn3 }"
                :on-change="imgChange3"
                :before-upload="beforeUpload"
                :file-list="addForm.public_licence_List"
              >
                <i slot="default" class="el-icon-plus"></i>
                <div
                  style="
                    transform: translateY(-85%);
                    color: grey;
                    font-size: 14px;
                  "
                >
                  上传图片
                </div>
                <div class="el-upload__tip" slot="tip">
                  <ul
                    style="margin-left: -25px; line-height: 20px; color: grey"
                  >
                    <li>请上传jpg或png格式的图片，大小不超过2M</li>
                    <li>保持证照清晰无遮挡</li>
                  </ul>
                </div>
              </el-upload>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="门头照" prop="merchant_photo">
              <el-upload
                :action="ossUrl"
                :headers="ossHeader"
                list-type="picture-card"
                :auto-upload="true"
                :limit="1"
                v-model="addForm.merchant_photo"
                :on-success="uploadSuccess4"
                :on-preview="handlePictureCardPreview"
                :on-remove="handleRemove4"
                :on-error="uploadError"
                :data="{ system: 'chongtai', module: '门头照' }"
                :class="{ uoloadSty: showBtn4, disUoloadSty: noneBtn4 }"
                :on-change="imgChange4"
                :before-upload="beforeUpload"
                :file-list="addForm.merchant_photo_List"
              >
                <i slot="default" class="el-icon-plus"></i>
                <div
                  style="
                    transform: translateY(-85%);
                    color: grey;
                    font-size: 14px;
                  "
                >
                  上传图片
                </div>
                <div class="el-upload__tip" slot="tip">
                  <ul
                    style="margin-left: -25px; line-height: 20px; color: grey"
                  >
                    <li>请上传jpg或png格式的图片，大小不超过2M</li>
                    <li>上传的图片尺寸为350*750px，或与之等长宽比的图片</li>
                  </ul>
                </div>
              </el-upload>
            </el-form-item>
          </el-col>
          <el-col :span="16">
            <el-form-item label="内部装修照" prop="inner_photo">
              <el-upload
                :action="ossUrl"
                :headers="ossHeader"
                list-type="picture-card"
                :auto-upload="true"
                :limit="imgLimitInner"
                v-model="addForm.inner_photo"
                :on-success="uploadSuccess5"
                :on-preview="handlePictureCardPreview"
                :on-remove="handleRemove5"
                :on-error="uploadError"
                :data="{ system: 'chongtai', module: '内部装修照' }"
                :class="{ uoloadSty: showBtn5, disUoloadSty: noneBtn5 }"
                :on-change="imgChange5"
                :before-upload="beforeUpload"
                :file-list="addForm.inner_photo_List"
              >
                <i slot="default" class="el-icon-plus"></i>
                <div
                  style="
                    transform: translateY(-85%);
                    color: grey;
                    font-size: 14px;
                  "
                >
                  上传图片
                </div>
                <div class="el-upload__tip" slot="tip">
                  <ul
                    style="margin-left: -25px; line-height: 20px; color: grey"
                  >
                    <li>请上传jpg或png格式的图片，大小不超过2M</li>
                    <li>保证照片清晰无遮挡，最多上传5张</li>
                  </ul>
                </div>
              </el-upload>
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
      <el-row style="margin-top: 10px">
        <el-button @click="$router.push('/hospital/Hospital')">
          取 消
        </el-button>
        <el-button class="theme-background-color" @click="saveInfo"
          >保 存</el-button
        >
      </el-row>
      <!-- 放大图片弹窗 -->
      <el-dialog :visible.sync="dialogVisible" width="45%">
        <img width="100%" :src="dialogImageUrl" alt="" />
      </el-dialog>
    </el-form>
  </div>
</template>

<script>
import regionData from '../../assets/js/regionChoose.js'
export default {
  data() {
    var checkphone = (rule, value, callback) => {
      const phoneReg = /(^1[3|4|5|6|7|8|9]\d{9}$)|(^09\d{8}$)/
      if (value == '') {
        callback(new Error('请输入手机号'))
      } else if (!phoneReg.test(value)) {
        // 引入methods中封装的检查手机格式的方法
        callback(new Error('请输入正确的手机号!'))
      } else {
        callback()
      }
    }
    var checkStart = (rule, value, callback) => {
      if (value == '') {
        callback(new Error('请输入营业开始时间'))
      } else if (
        this.addForm.working_duration_end != '' &&
        value > this.addForm.working_duration_end
      ) {
        callback(new Error('营业开始时间不能晚于营业结束时间!'))
      } else {
        callback()
      }
    }
    var imageValidator = (rule, value, callback) => {
      if (value == undefined || value == '' || value.length == 0) {
        callback(new Error('请上传图片'))
      }
      callback()
    }
    return {
      // 下拉框数据
      selectData: [],
      // 基本信息表单
      addForm: {
        id: '',
        title: '',
        provider_id: '',
        tel: '',
        area: [],
        address: '',
        lng: '',
        lat: '',
        leading_name: '',
        leading_phone: '',
        employee_num: '',
        working_duration_start: '',
        working_duration_end: '',
        service_item: [],
        use_system: '',
        clear_type: '',
        remark: '',
        business_licence: '',
        animal_licence: '',
        public_licence: '',
        merchant_photo: '',
        inner_photo: [],

        business_licence_List: [],
        animal_licence_List: [],
        public_licence_List: [],
        merchant_photo_List: [],
        inner_photo_List: []
      },
      addFormRules: {
        title: [
          { required: true, message: '请输入', trigger: 'blur' },
          { min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur' }
        ],
        provider_id: [{ required: true, message: '请选择', trigger: 'change' }],
        tel: [{ required: true, message: '请输入', trigger: 'blur' }],
        area: [{ required: true, message: '请选择', trigger: 'change' }],
        address: [{ required: true, message: '请输入', trigger: 'blur' }],
        lng: [{ required: true, message: '请输入', trigger: 'number' }],
        lat: [{ required: true, message: '请输入', trigger: 'blur' }],
        leading_name: [{ required: true, message: '请输入', trigger: 'blur' }],
        leading_phone: [
          { required: true, message: '请输入', trigger: 'blur' },
          { validator: checkphone, message: '请输入正确的手机号' }
        ],
        employee_num: [{ required: true, message: '请输入', trigger: 'blur' }],
        working_duration_start: [
          { required: true, message: '请选择', trigger: 'change' },
          { validator: checkStart, message: '开始营业时间不能晚于结束营业时间' }
        ],
        working_duration_end: [
          { required: true, message: '请选择', trigger: 'change' }
        ],
        service_item: [
          { required: true, message: '请选择', trigger: 'change' }
        ],
        use_system: [{ required: true, message: '请选择', trigger: 'change' }],
        clear_type: [{ required: true, message: '请选择', trigger: 'change' }],
        business_licence: [
          {
            required: true,
            validator: imageValidator,
            message: '请上传营业执照'
          }
        ],
        animal_licence: [
          {
            required: true,
            validator: imageValidator,
            message: '请上传动物诊疗许可证'
          }
        ],
        // public_licence: [
        //   {
        //     required: true,
        //     validator: imageValidator,
        //     message: '请上传公共卫生许可证'
        //   }
        // ],
        merchant_photo: [
          { required: true, validator: imageValidator, message: '请上传门头照' }
        ],
        inner_photo: [
          {
            required: true,
            validator: imageValidator,
            message: '请上传内部装修照'
          }
        ]
      },

      // 省市区级联属性
      options: regionData,
      props: {
        // checkStrictly: true,
        value: 'name',
        label: 'name',
        children: 'childs'
      },

      // 图片上传所需参数
      dialogImageUrl: '',
      dialogVisible: false,
      ossUrl: this.GLOBAL.ossUrl,
      ossHeader: this.GLOBAL.ossHeader,
      // 营业执照
      showBtn1: true,
      noneBtn1: false,
      // 动物诊疗许可证
      showBtn2: true,
      noneBtn2: false,
      // 公共卫生许可证
      showBtn3: true,
      noneBtn3: false,
      // 门头照
      showBtn4: true,
      noneBtn4: false,
      // 内部装修照
      showBtn5: true,
      noneBtn5: false,
      imgLimitInner: 5
    }
  },
  created() {
    this.getSelectData()
    const id = this.$route.query && this.$route.query.id
    console.log(id)
    if (id != undefined) {
      this.getDetail()
    }
  },
  methods: {
    async getSelectData() {
      const { data: res } = await this.$http.post('/admin/Data/find', {
        code: 'get_hospital_service,provider'
      })
      if (res.meta.status !== 200) {
        return this.$message.error(res.meta.msg)
      }
      this.selectData = res.data
    },
    // 初始数据赋值
    initial(data) {
      var dataTemp = JSON.parse(JSON.stringify(data))
      console.log(dataTemp)

      dataTemp.area = [data.province, data.city, data.area]
      dataTemp.inner_photo = dataTemp.inner_photo
        ? dataTemp.inner_photo.split(',')
        : []

      dataTemp.business_licence_List = [
        { name: '', url: data.business_licence }
      ]
      dataTemp.animal_licence_List = [{ name: '', url: data.animal_licence }]
      dataTemp.public_licence_List =
        data.public_licence != ''
          ? [{ name: '', url: data.public_licence }]
          : []
      dataTemp.merchant_photo_List = [{ name: '', url: data.merchant_photo }]
      // 处理多张图片
      var innerPhotoListTemp = []
      for (let i = 0; i < dataTemp.inner_photo.length; i++) {
        var imageObject = {}
        imageObject.name = ''
        imageObject.url = dataTemp.inner_photo[i]
        innerPhotoListTemp.push(imageObject)
      }
      dataTemp.inner_photo_List = innerPhotoListTemp

      this.noneBtn1 = dataTemp.business_licence_List.length === 1
      this.noneBtn2 = dataTemp.animal_licence_List.length === 1
      this.noneBtn3 = dataTemp.public_licence_List.length === 1
      this.noneBtn4 = dataTemp.merchant_photo_List.length === 1
      this.noneBtn5 = dataTemp.inner_photo_List.length === 5

      // 处理基本表单信息
      for (const key in this.addForm) {
        this.addForm[key] = dataTemp[key]
      }
    },
    async getDetail() {
      const { data: res } = await this.$http.post(
        '/admin/hospital/hospitalDetail',
        {
          id: this.$route.query.id
        }
      )
      if (res.meta.status !== 200) {
        return this.$message.error(res.meta.msg)
      }
      this.initial(res.data)
    },
    findAddress() {
      window.open('https://lbs.qq.com/tool/getpoint/')
    },
    // -------------图片上传公共方法------------
    uploadError(err, file, List) {
      this.$message.error(err)
    },
    beforeUpload(file) {
      const isJPG = file.type === 'image/jpeg' || file.type === 'image/png'
      const isLt2M = file.size / 1024 / 1024 < 2

      if (!isJPG) {
        this.$message.error('上传图片只能是 JPG/PNG 格式!')
      } else if (!isLt2M) {
        this.$message.error('上传图片大小不能超过 2MB!')
      }
      return isJPG && isLt2M
    },
    // 放大图片(通用)
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url
      this.dialogVisible = true
    },
    // -----------------------------------------

    // ----------------营业执照------------------
    uploadSuccessMain(response, file, fileList) {
      if (Number.parseInt(response.code) === 10001) {
        this.addForm.business_licence = response.data.url
      } else {
        this.$message.error(response.message)
        var a = fileList.findIndex((item) => item.uid === file.uid)
        if (a !== -1) {
          fileList.splice(a, 1)
        }
      }
    },
    //   删除图片
    handleRemoveMain(file, fileList) {
      this.addForm.business_licence = ''
      this.noneBtn1 = fileList.length === 1
    },
    // 上传图片后隐藏上传按钮
    imgChangeMain(file, fileList) {
      this.noneBtn1 = fileList.length === 1
    },
    // -----------------------------------------
    // ---------------动物诊疗许可证-------------
    uploadSuccess2(response, file, fileList) {
      if (Number.parseInt(response.code) === 10001) {
        this.addForm.animal_licence = response.data.url
      } else {
        this.$message.error(response.message)
        var a = fileList.findIndex((item) => item.uid === file.uid)
        if (a !== -1) {
          fileList.splice(a, 1)
        }
      }
    },
    //   删除图片
    handleRemove2(file, fileList) {
      this.addForm.animal_licence = ''
      this.noneBtn2 = fileList.length === 1
    },
    // 上传图片后隐藏上传按钮
    imgChangeMain2(file, fileList) {
      this.noneBtn2 = fileList.length === 1
    },
    // -----------------------------------------
    // ---------------公共卫生许可证-------------
    uploadSuccess3(response, file, fileList) {
      if (Number.parseInt(response.code) === 10001) {
        this.addForm.public_licence = response.data.url
      } else {
        this.$message.error(response.message)
        var a = fileList.findIndex((item) => item.uid === file.uid)
        if (a !== -1) {
          fileList.splice(a, 1)
        }
      }
    },
    //   删除图片
    handleRemove3(file, fileList) {
      this.addForm.public_licence = ''
      this.noneBtn3 = fileList.length === 1
    },
    // 上传图片后隐藏上传按钮
    imgChange3(file, fileList) {
      this.noneBtn3 = fileList.length === 1
    },
    // -----------------------------------------
    // ------------------门头照------------------
    uploadSuccess4(response, file, fileList) {
      if (Number.parseInt(response.code) === 10001) {
        this.addForm.merchant_photo = response.data.url
      } else {
        this.$message.error(response.message)
        var a = fileList.findIndex((item) => item.uid === file.uid)
        if (a !== -1) {
          fileList.splice(a, 1)
        }
      }
    },
    //   删除图片
    handleRemove4(file, fileList) {
      this.addForm.merchant_photo = ''
      this.noneBtn4 = fileList.length === 1
    },
    // 上传图片后隐藏上传按钮
    imgChange4(file, fileList) {
      this.noneBtn4 = fileList.length === 1
    },
    // -----------------------------------------
    // ----------------内部装修照----------------
    uploadSuccess5(response, file, fileList) {
      if (Number.parseInt(response.code) === 10001) {
        file.url = response.data.url
        this.addForm.inner_photo_List.push(file)
        this.addForm.inner_photo.push(response.data.url)
        console.log(this.addForm.inner_photo)
      } else {
        this.$message.error(response.message)
        var a = fileList.findIndex((item) => item.uid === file.uid)
        if (a !== -1) {
          fileList.splice(a, 1)
        }
      }
    },
    //   删除图片
    handleRemove5(file, fileList) {
      console.log(file, fileList)
      var a = this.addForm.inner_photo_List.findIndex(
        (item) => item.uid === file.uid
      )
      if (a !== -1) {
        this.addForm.inner_photo_List.splice(a, 1)
      }

      var b = this.addForm.inner_photo.findIndex((item) => item === file.url)
      if (b !== -1) {
        this.addForm.inner_photo.splice(b, 1)
      }
      this.noneBtn5 = fileList.length >= this.imgLimitInner
      console.log(this.addForm.inner_photo, this.addForm.inner_photo_List)
    },
    // 上传图片后隐藏上传按钮
    imgChange5(file, fileList) {
      this.noneBtn5 = fileList.length === this.imgLimitInner
    },
    // -----------------------------------------
    async saveInfo() {
      this.$refs.addFormRef.validate(async (valid) => {
        if (!valid) return

        var postData = JSON.parse(JSON.stringify(this.addForm))

        // 处理数据（内部装修图）
        postData.inner_photo = postData.inner_photo.join(',')

        const { data: res } = await this.$http.post(
          'admin/hospital/addHospital',
          postData
        )
        if (res.meta.status !== 200) {
          return this.$message.error(res.meta.msg)
        }
        this.$message.success(res.meta.msg)
        this.$router.push('/hospital/Hospital')
      })
    }
  }
}
</script>

<style lang="less" scoped>
.el-form {
  width: 100%;
  margin-left: 15px;
  .el-cascader,
  .el-select {
    width: 100%;
  }
  .el-date-editor {
    width: 100% !important;
  }
  .el-checkbox {
    min-width: 80px;
  }
  .baseInfoDiv {
    width: 70%;
  }
  .el-card {
    padding-left: 10px;
  }
}
/deep/ .uoloadSty .el-upload--picture-card {
  width: 300px;
  display: true;
}
/deep/ .disUoloadSty .el-upload--picture-card {
  display: none; /* 上传按钮隐藏 */
}
/deep/ .uoloadSty .el-upload-list__item {
  width: 300px;
}

.imageCard {
  margin-top: 10px;
  /deep/.el-form-item__label {
    float: none;
    display: inline-block;
    text-align: left;
    padding: 0 0 10px;
  }
  /deep/.el-form-item__content {
    margin-left: 0px !important;
  }
}
</style>
